<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<style>
    html,body{
        width:100%''
    }
    .container{
        width:100%;
        display:flex;
        flex-direction:column;
    }
    .container div{
        width:200px;
        height:200px;
        background:plum;
    }
    .div2{
        align-self: center;
    }
    .div3{
        align-self: flex-end;
    }
</style>
<body>
    <div class="container">
        <div class="div1">1</div>
        <div class="div2">2</div>
        <div class="div3">3</div>
    </div>
    <script>
        let $body = document.querySelector("body")
       let arr = [1,2,3,4,5];
       let i,length = arr.length;
       for(i=0;i<length;i++){
           console.log(i)
           $body.onclick= function(){
               alert(i)
           }
       }
    </script>
</body>
</html>